home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-25 | 2.9 KB | 102 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWRecevr.h
- // Release Version: $ ODF 1 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWRECEVR_H
- #define FWRECEVR_H
-
- #ifndef FWINTERE_H
- #include "FWIntere.h"
- #endif
-
- #ifndef FWTCOLL_H
- #include "FWTColl.h"
- #endif
-
- #ifndef __SOM__
- #include <som.xh>
- #endif
-
- //========================================================================================
- // Foward declarations
- //========================================================================================
-
- class FW_CNotification;
- class FW_CNotifier;
-
- //========================================================================================
- // CLASS FW_MReceiver
- //========================================================================================
-
- class FW_MReceiver
- {
- public:
- FW_DECLARE_CLASS
- FW_DECLARE_AUTO(FW_MReceiver)
- friend class FW_CReceiverInterestIterator;
-
- public:
- FW_MReceiver();
- virtual ~FW_MReceiver();
-
- virtual void HandleNotification(Environment* ev, const FW_CNotification& notification) = 0;
-
- void AddInterest(const FW_CInterest& interest);
- void RemoveAllInterests();
- void RemoveInterest(const FW_CInterest& interest);
-
- void AddNotifier(FW_MNotifier* notifier, FW_Message msg);
- void RemoveNotifier(FW_MNotifier* notifier, FW_Message msg);
-
- void Connect();
- void Disconnect();
-
- FW_Boolean IsConnected() const;
-
- private:
- FW_Boolean fIsConnected;
- FW_TOrderedCollection<FW_CInterest> fInterestList;
- };
-
- //----------------------------------------------------------------------------------------
- // FW_MReceiver::IsConnected
- //----------------------------------------------------------------------------------------
-
- inline FW_Boolean FW_MReceiver::IsConnected() const
- {
- return fIsConnected;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_MReceiver::AddNotifier/RemoveNotifier
- //----------------------------------------------------------------------------------------
-
- inline void FW_MReceiver::AddNotifier(FW_MNotifier* notifier, FW_Message msg)
- {
- AddInterest(FW_CInterest(notifier, msg));
- }
-
- inline void FW_MReceiver::RemoveNotifier(FW_MNotifier* notifier, FW_Message msg)
- {
- RemoveInterest(FW_CInterest(notifier, msg));
- }
-
- //========================================================================================
- // class FW_CReceiverInterestIterator
- //========================================================================================
-
- class FW_CReceiverInterestIterator : public FW_TOrderedCollectionIterator<FW_CInterest>
- {
- public:
- FW_CReceiverInterestIterator(FW_MReceiver* receiver) :
- FW_TOrderedCollectionIterator<FW_CInterest>(&receiver->fInterestList) {}
- ~FW_CReceiverInterestIterator() {}
- };
-
- #endif
-